﻿using HomagChina.CCT.DataTypeModel;
using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using HomagChina.CCT.ViewModels;
using System.Collections.ObjectModel;
using static HomagChina.CCT.ProcessResourceInternal;
using static HomagChina.CCT.Utility;
using Application = System.Windows.Application;

namespace HomagChina.CCT.Router
{
    public class HomeRoute
    {
        public RouterItemDataModel HomeRouteModel { get; set; }

        public HomeRoute()
        {
            var model = new HomeViewModel();
            HomeRouteModel = new RouterItemDataModel()
            {
                ID = "Home",
                viewLabel = GetLocaText("Home"),
                viewName = "Home",
                keepalive = false,
                viewModelName = "HomeViewModel",
                ViewModel = model,
                userControl = GetUserControlInstance("Home"),
                Image = null,
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>
                {
                    new FunctionKeyBarItemDataModel() {
                        Header =GetLocaText("Exit"),
                        Position = 12,
                        Icon = GetIconBrush(Icon.Close,ImageDecoration.Circle),
                        Command = new RelayCommand(() => { Application.Current.Shutdown(); })
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header =GetLocaText("DeviceGraph"),
                        Position = 10,
                        Icon = GetIconBrush(Icon.SelectAll,overlayIcon: OverlayIcon.Pencil),
                        Command =new RelayCommand(() => { NavigateServices.Instance.NavigateTo("IntelligencePlatform"); })
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header =GetLocaText("LoadProject"),
                        Position = 9,
                        Icon = GetIconBrush(Icon.SwapVertical),
                        Command =new RelayCommand(model.HandleLoadProject)
                    },
                }
            };
            HomeRouteModel.userControl.DataContext = model;
        }
    }
}